{extend name='extra@admin/content'}

{block name="button"}
<div class="nowrap pull-right" style="margin-top:10px">
    <button data-modal='{:url("$classuri/add")}' data-title="添加商品属性" class='layui-btn layui-btn-small'>
        <i class='fa fa-plus'></i> 添加商品属性
    </button>
    <button data-update data-field='delete' data-action='{:url("$classuri/del")}' class='layui-btn layui-btn-small layui-btn-danger'>
        <i class='fa fa-remove'></i> 删除商品属性
    </button>
</div>
{/block}

{block name="content"}

<form onsubmit="return false;" data-auto="true" method="post">
    {if empty($list)}
    <p class="help-block text-center well">没 有 记 录 哦！</p>
    {else}
    <input type="hidden" value="resort" name="action"/>
    <table class="layui-table" lay-skin="line" lay-size="sm">
        <thead>
            <tr>
                <th class='list-table-check-td'>
                    <input data-none-auto="" data-check-target='.list-check-box' type='checkbox'/>
                </th>
                <th class='text-left nowrap'>ID</th>
                <th class='text-left nowrap'>属性名称</th>
                <th class='text-left nowrap'>直属分类</th>
                <th class='text-left nowrap'>属性类型</th>
                <th class='text-left nowrap'>可选值</th>
                <th class='text-left nowrap'>操作</th>
            </tr>
        </thead>
        <tbody>
            {foreach $list as $key=>$vo}
            <tr>
                <td class='list-table-check-td'>
                    <input class="list-check-box" value='{$vo.id}' type='checkbox'/>
                </td>
                <td class='text-left nowrap'>
                    {$vo.id}
                </td>
                <td class='text-left nowrap'>
                    {$vo.a_name|default="<span class='color-desc'>还没有设置属性名称</span>"}
                </td>
                <td class='text-left nowrap'>
                    {$vo.cname|default="<span class='color-desc'>还没有设置直属分类</span>"}
                </td>
                <td class='text-left nowrap'>
                    {switch name="$vo.type" }
                        {case value="1"}<span style="color: #00abff;">文本框</span>{/case}
                        {case value="2"}<span style="color: #00abff;">下拉列表</span>{/case}
                        {case value="3"}<span style="color: #00abff;">多文本框</span>{/case}
                    {/switch}
                </td>
                <td class='text-left nowrap'>
                    {$vo.a_value|default=""}
                </td>
                <td class='text-left nowrap'>
                    {if auth("$classuri/edit")}
                    <span class="text-explode">|</span>
                    <a data-modal='{:url("$classuri/edit")}?id={$vo.id}' href="javascript:void(0)">编辑</a>
                    {/if}
                    {if auth("$classuri/del")}
                    <span class="text-explode">|</span>
                    <a data-update="{$vo.id}" data-field='delete' data-action='{:url("$classuri/del")}?id={$vo.id}'
                       href="javascript:void(0)">删除</a>
                    {/if}
                </td>
            </tr>
            {/foreach}
        </tbody>
    </table>
    {if isset($page)}<p>{$page}</p>{/if}
    {/if}
    <script>
        window.laydate.render({range: true, elem: '#range-date', format: 'yyyy/MM/dd'});
    </script>
</form>
{/block}